var app = getApp();

Page({
  data: {
    userName: '',
    avatar: '',
    certification: ''
  },
  onShow: function() {
    var that = this;
    that.setData({
      userName: wx.getStorageSync("userName"),
      avatar: wx.getStorageSync("avatar"),
      certification: wx.getStorageSync("certification") == 'false' ? '未认证' : '已认证'
    });
    that.getData();
  },
  getData: function() {
    var that = this;
    app.JsonPost("Api/User/index", {}, function(res) {
      console.log(res);
      that.setData({
        signDays: res.signDays,
        signin: res.isSigned
      })
    });
  },
  signin: function(e) {
    var that = this;
    app.JsonPost("Api/UserSign/add", {}, function(res) {
      console.log(res);
      that.getData();
    });
  },
  personal: function() {
    wx.navigateTo({
      url: "pages/personal/personal"
    })
  },
  myTrip: function() {
    wx.navigateTo({
      url: "../trip/myTrip"
    })
  },
  moneybag: function() {
    wx.navigateTo({
      url: "pages/moneybag/moneybag"
    })
  },
  myCredit: function() {
    wx.navigateTo({
      url: '../user/credit?userId=' + wx.getStorageSync("userId")
    })
  },
  myCollect: function() {
    wx.navigateTo({
      url: "pages/collect/collect"
    })
  },
  certification: function() {
    wx.navigateTo({
      url: "pages/certification/certification"
    })
  },
  seekHelp: function() {
    wx.navigateTo({
      url: "pages/help/help"
    })
  }
})